using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;

public class SquareManger : MonoBehaviour
{




    public Button square1;
    public Button square2;
    public Button square3;





    private void Awake()
    {

        square1.onClick.AddListener(delegate {
            build(square1.transform);
          //  points.Add(square1.transform);
        });


        square2.onClick.AddListener(delegate {
           build(square2.transform);
           // points.Add(square2.transform);
        });

        square3.onClick.AddListener(delegate {
          //  build(square3.transform);
         //   points.Add(square3.transform);
        });


    }

    public int pointIdx;


    public List<Transform> points=new List<Transform>();
    public List<Vector3> points2=new List<Vector3>();



    void build(Transform transform) {

       // Vector3 vector3 = Camera.main.WorldToScreenPoint(transform.position);
        Vector3 vector3 = Camera.main.ScreenToWorldPoint(transform.position);
        vector3 = new Vector3(vector3.x,vector3.y,0);

        points2.Add(vector3);
        points.Add(transform);
        //pointIdx++;





        LineManger.Instance.writeLine(points2);



    }


    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
